<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>EAIS -Sort Enzyme</title>
	<script type="text/javascript" src="jquery-1.3.1.min.js"></script>
	<script type="text/javascript" src="jquery.tablesorter.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#sortedtable").tablesorter({ sortlist: [0,0] });
		});
	</script>
	<style type="text/css">
		#sortedtable thead th {
			color: #00f;
			font-weight: bold;
			text-decoration: underline;
		}
	</style>
</head>

<body>

	<?php
	
		class enzyme{
		
			var $enzyme;
			var $details;
			
			function sendEnzymeDetails($details){	
				$this->details['enzyme'] = $details['item'];
			}
			
			function RetrieveEnzymes(){
				$enzyme = $this->details['enzyme'];
			
				$user="root";
				$password="admin";
				$database="eais";
				$link = mysql_connect('localhost', 'root', '');
				mysql_select_db('eais', $link);
				
				$keyword = str_ireplace(" ","%",$enzyme);

				$query = "SELECT * FROM enzyme WHERE name like '%" . $keyword . "%' or origin like '%" . $keyword . "%' or testProcedure like '%" . $keyword . "%' or dateSubmitted like '%" . $keyword . "%'";
				
				echo $query;
				$result = mysql_query($query) or die(mysql_error());
				
				$size = mysql_num_rows($result);

				if($size > 0) {
						echo "<h1>Enzyme Information</h1>";
						echo "<table id=\"sortedtable\" border=\"1\" cellpadding =\"2\" cellspacing =\"3\" >\n";
						echo "<thead>\n<tr>";
						echo "<th> Enzyme Name</a></th>";
						echo "<th>Origin</th>";
						echo "<th>Procedure</th>";
						echo "<th>Date</th>";
						echo "</tr>\n</thead>\n";
						while($row = mysql_fetch_array($result)){
							echo "<tr><td>$row[name]</td> <td>$row[origin]</td> <td>$row[testProcedure]</td> <td>$row[dateSubmitted]</td> </tr>\n";
						}
						echo "</table><br />\n";
				}
				else
					echo "<br />No Result Found.<br />";	
		}
	}	
	?>
</body>
</html>